package one.stand.config;

import one.stand.interceptor.WebAppInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author: QIK
 * @CreateDate: 2019/4/17 10:36
 */
@Configuration
public class WebAppConfig implements WebMvcConfigurer {
    @Autowired
    @Lazy
    WebAppInterceptor webAppInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 添加一个拦截器，拦截以/test为前缀的 url路径
        registry.addInterceptor(webAppInterceptor).addPathPatterns("/**");
    }
}
